<?php
include_once $_SERVER['DOCUMENT_ROOT'].'/lib/Validator.php';

class GeoValidator extends Validator{
	protected static $_instance;

	private function __construct(){}
	private function __clone(){}
	public static function inst(){
	  if( null===self::$_instance ){
	    self::$_instance=new self();
		}
		return self::$_instance;
	}

	public function country($data){
	  $fld=array(
	    'ctr_id'=>array('ch2','upc'),
	    'ctr_sysname'=>'str',
	    'ctr_name'=>'str',
	    'ctr_lang'=>'ch2',
	    'ctr_cur'=>array('ch3','upc'),
		);
		return $this->makeCheck($data,$fld);
	}
	public function region($data){
	  $fld=array(
	    'reg_id'=>'rgi:rg\S{32}',
	    'reg_sysname'=>'str',
	    'reg_name'=>'str',
	    'reg_ch1'=>'ch1',
	    'reg_key_ctr'=>'ch2',
		);
		return $this->makeCheck($data,$fld);
	}
	public function city($data){
	  $fld=array(
	    'cit_id'=>'rgi:ct\S{32}',
			'cit_sysname'=>'str',
			'cit_key_ctr'=>array('ch2','upc'),
			'cit_key_reg'=>'rgi:rg\S{32}',
			'cit_key'=>'rgi:ct\S{32}',
			'cit_name'=>'str',
			'cit_ln'=>'ch2'
		);
		return $this->makeCheck($data,$fld);
	}
	public function urbanarea($data){
	  $fld=array(
	    'ua_id'=>'rgi:ub\S{32}',
			'ua_sysname'=>'str',
			'ua_key_ctr'=>array('ch2','upc'),
			'ua_key_reg'=>'rgi:rg\S{32}',
			'ua_key_cit'=>'rgi:ct\S{32}',
			'ua_key'=>'rgi:ub\S{32}',
			'ua_name'=>'str',
			'ua_ln'=>'ch2'
		);
		return $this->makeCheck($data,$fld);
	}
	public function addr($data){
	  $fld=array(
	    'addr_id'=>'rgi:ad\S{32}',
			'addr_sysname'=>'str',
			'addr_lat'=>'flt',
			'addr_lng'=>'flt',
			'addr_key_ctr'=>array('ch2','upc'),
			'addr_key_reg'=>'rgi:rg\S{32}',
			'addr_key_cit'=>'rgi:ct\S{32}',
			'addr_key_ua'=>'rgi:ub\S{32}',
			'addr_key'=>'rgi:ad\S{32}',
			'addr_name'=>'str',
			'addr_ln'=>'ch2'
		);
		return $this->makeCheck($data,$fld);
	}
	public function point($data){
	  $fld=array(
	    'p_id'=>'rgi:pt\S{32}',
			'p_sysname'=>'str',
			'p_key_addr'=>'rgi:ad\S{32}',
			'p_key_ctr'=>array('ch2','upc'),
			'p_key_reg'=>'rgi:rg\S{32}',
			'p_key_cit'=>'rgi:ct\S{32}',
			'p_key_ua'=>'rgi:ub\S{32}',
			'p_key'=>'rgi:pt\S{32}',
			'p_name'=>'str',
			'p_ln'=>'ch2'
		);
		return $this->makeCheck($data,$fld);
	}
	public function network($data){
	  $fld=array(
	    'net_id'=>'rgi:nt\S{32}',
			'net_sysname'=>'str',
			'net_key'=>'rgi:nt\S{32}',
			'net_ch1'=>'ch1',
			'net_name'=>'str',
			'net_ln'=>'ch2'
		);
		return $this->makeCheck($data,$fld);
	}
}
?>
